/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entityclasses;

import strategies.ShareStrategy;
import strategies.ShareStrategy;

/**
 *
 * @author umutcan
 */
public class LinkTextShare extends ShareStrategy {
    
    String allText = "";
    String labelText = "";
    String linkText = "";
    String lastText = "";
    @Override
    public void share(String content) {
       allText=content;
       parseText();
       
    }
    
    public void parseText()
    {
        String[] pieces = allText.split(" ");
        int linkState = 100;
        for(int i=0;i<pieces.length;i++)
        {
            if(pieces[i].startsWith("http://"))
            {
                linkState = i;
                linkText = pieces[i];
            }
            else
            {
                if(i<linkState)
                    labelText += pieces[i];
                else lastText += pieces[i];
            }
        }
    }
    
}
